﻿<AutoComplete @bind-Value="@value" Options="@options" OnInput="OnInput" OnSelectionChange="OnSelectionChange" OnActiveChange="OnActiveChange"/>
<Divider></Divider>
<span>bind-Value:@value</span>
<br />
<span>SelectedValue:@selectItem?.Value</span>
<br />
<span>ActiveValue:@activeItem?.Value</span>

@code
{
    private string value;

    List<string> options = new List<string>();


    void OnInput(ChangeEventArgs e)
    {
        var v = e.Value.ToString();
        if (string.IsNullOrWhiteSpace(v))
            options = new List<string>();
        else
            options = new List<string>()
{
                v, v + "1", v + "2"
            };
    }

    private AutoCompleteOption selectItem;

    void OnSelectionChange(AutoCompleteOption item)
    {
        selectItem = item;
    }

    private AutoCompleteOption activeItem;

    void OnActiveChange(AutoCompleteOption item)
    {
        activeItem = item;
    }
}